home *** CD-ROM | disk | FTP | other *** search
Wrap
/* SendMail.thor by Troels Walsted Hansen <troels@stud.cs.uit.no> ** $VER: SendMail.thor v1.10 (27.12.95) ** ** Now change the two variables below to whatever fits for your setup. ** MailSystem is the name of your TCP/SOUP/UUCP/whatever email system in ** THOR, and MailConfName is obviously the name of your email conference in ** THOR. ** ** Setting AddSignature to 'Yes' will make SendMail.thor read your conference/ ** BBS/global signature settings and add that signature to your mails. ** ** Note: THOR does not have to be running for this script to work! ** ** History: ** ¯¯¯¯¯¯¯¯ ** SendMail.thor v1.00 (07.08.95) ** · First release. ** ** SendMail.thor v1.10 (27.12.95) ** · Now optionally appends signature configured in THOR to the email. ** · Updated my email address :-) ** · Implemented previously non-existant errorchecking and reporting ** ** SendMail.thor v1.11 (24.04.96) ** . Work with the browser Voyager by Olli Wagner ** . Add 'SendEvent' variable to automatically send the e-mail, if needed. ** ** Modified by Eric Giroux (ericgir@cam.org) for Voyager. ** MUI's built-in arexx command INFO is used to determine the public ** screen. ** ** In SETTINGS/NETWORK/Mailto: app ** Enter {path}rx {path}Mailto-Thor.VRX %h ** */ options results CmdPath = 'Thor:bin/' /* Path to SendTCP and GetTCP */ MailServer = 'POP.HIP.CAM.ORG' /* Your mail server */ NewsServer = 'NNTP.HIP.CAM.ORG' /* Your news server */ NumSockets = 4 /* The number of sockets for Thor to use (1-4) */ SendEvent = "Y" /* Y to send event automatically or N for doing it manually */ MailSystem = 'News&Mail' MailConfName = 'EMail' AddSignature = 'Yes' call pubscreen() /* DON'T CHANGE ANYTHING BELOW HERE */ if ~show('p', 'BBSREAD') then do address command "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead" "WaitForPort BBSREAD" end address(BBSREAD) /* parse the header Voyager provides */ parse ARG EVENT.TOADDR if pos('@',EVENT.toaddr) = 0 then exit call pragma('stack',10000) file = "t:" || EVENT.TOADDR address command 'ced -keepio -pubscreen='PubScreen file EVENT.SUBJECT = "mailto: " || EVENT.TOADDR UNIQUEMSGFILE bbsname '"'MailSystem'"' stem UNIQUEFILE if(rc ~= 0) then do call showerror('UNIQUEMSGFILE BBSRead command failed: ' || BBSREAD.LASTERROR) exit 20 end call open(tmp, UNIQUEFILE.NAME, W) if exists(file) then do call open(temp, file, R) do until eof(temp) call writeln(tmp,readln(temp)) end call close(temp) /* add signature from the EMail conference/BBS/Global Settings */ if(upper(AddSignature) = 'YES') then do GETCONFDATA BBSNAME '"'MailSystem'"' CONFNAME '"'MailConfName'"' STEM CONFD if(CONFD.SIGNATURE = "") then do GETBBSDATA BBSNAME '"'MailSystem'"' STEM BBSD if(BBSD.SIGNATURE = "") then do GETGLOBALDATA STEM GLOBD if(GLOBD.SIGNATURE = "") then do call showerror('No signature configured in either conference, bbs og global settings! Please correct this in THOR or turn off signature adding in SendMail.thor.') exit 20 end else sig = 'thor:' || GLOBD.SIGNATURE end else sig = 'thor:' || BBSD.SIGNATURE end else sig = 'thor:' || CONFD.SIGNATURE drop CONFD.; drop BBSD.; drop GLOBD. if(sig ~= "") then do /* signature may be a filename */ if(exists(sig)) then do call open(sigfh, sig, R) do until eof(sigfh) call writeln(tmp, readln(sigfh)) end call close(sigfh) end else call writeln(tmp, sig) /* or just a string */ end end call close(tmp) /* fill out some more variables that BBSREAD require */ EVENT.CONFERENCE = MailConfName EVENT.MSGFILE = UNIQUEFILE.FILEPART /* write the event */ WRITEBREVENT bbsname '"'MailSystem'"' event 0 stem EVENT if(rc ~= 0) then do call showerror('WRITEBREVENT BBSRead command failed: ' || BBSREAD.LASTERROR) exit 20 end address command 'c:delete >nil: ' file if upper(sendevent) = "Y" then call send end exit 0 /* sophisticated errorhandling :-) */ showerror: procedure expose MailSystem MailConfName AddSignature parse arg errormsg p=show('P',,) if(pos('MINDWALKER', p) > 0) then vport = word(substr(p, pos('MINDWALKER', p)), 1) else return call open(err, "T:SendMail.thor.error.html", W) call writeln(err, "<HTML><HEAD><TITLE>SendMail.thor encountered an error</TITLE></HEAD><BODY><H1>Sending mail aborted</H1>" || errormsg || "<P>Please remember to verify the following settings:<PRE>MailSystem = '" || MailSystem || "'" || '0a'x || "MailConfName = '" || MailConfName || "'" || '0a'x || "AddSignature = '" || AddSignature || "'" || "</PRE>If they are wrong, edit SendMail.thor and correct them. <hr> If this should happen to be an erroneous error, don't hesitate to contact the author, <A HREF=" || '"' || "http://www.cs.uit.no/~troels" || '"' || ">Troels Walsted Hansen</A>, preferably by <A HREF=" || '"' || "mailto:troels@stud.cs.uit.no" || '"' || ">email</A>.") call close(err) address(vport) 'openURL file://localhost/T:SendMail.thor.error.html' return SEND: If Show('p', 'AMITCP') = 1 then do Address BBSREAD GETBBSDATA SystemName stem BBSDATA If BBSDATA.NUMEVENTS ~= 0 Then do DO post = 1 TO 10 address command CmdPath'SendTCP ' MailSystem 'MAILSERVER ' MailServer 'NEWSSERVER ' NewsServer 'pubscreen='PubScreen IF RC=0 THEN DO LEAVE post END END end end RETURN PubScreen: If show('p', 'MINDWALKER') = 1 then do address MINDWALKER INFO SCREEN PubScreen = result end else PubScreen = 'Workbench' return